package org.springblade.modules.sga.service.impl;

import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.modules.sga.mapper.SgaDictMapper;
import org.springblade.modules.sga.mapper.SgaLabelMapper;
import org.springblade.modules.sga.service.ISgaDictService;
import org.springblade.modules.sga.vo.SgaDictLabelVO;
import org.springblade.modules.sga.vo.SgaDictVO;
import org.springblade.modules.system.entity.DictType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SgaDictServiceImpl extends BaseServiceImpl<SgaDictMapper, DictType> implements ISgaDictService {

	@Autowired
	protected SgaLabelMapper baseLabelMapper;

	@Override
	public SgaDictVO getDictByType(String type) {
		SgaDictVO dictByType = baseMapper.getDictByType(type);
		if (dictByType == null) {
			dictByType = baseLabelMapper.getDictByType(type);
		}
		return dictByType;
	}

	@Override
	public List<SgaDictLabelVO> getDictLabelByType(String type, String enterpriseSpecial) {
		return baseMapper.getDictLabelByType(type, enterpriseSpecial);
	}
}
